import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'title',
    label: '文章标题',
  },

  {
    component: 'Input',
    fieldName: 'username',
    label: '用户名',
  },
  {
    component: 'Input',
    fieldName: 'isReplied',
    label: '是否回复',
  }
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  {
    title: '主键ID',
    field: 'id',
    width: 100,
  },
  {
    title: '文章链接',
    field: 'articleLink',
  },
  {
    title: '封面链接',
    field: 'coverImageUrl',
    slots: { default: 'cover-image' },
    width: 180,
  },
  {
    title: '文章标题',
    field: 'title',
    width: 200,
  },
  {
    title: '作者链接',
    field: 'authorLink',
  },
  {
    title: '原始文章ID',
    field: 'originId',
  },
  {
    title: '审核状态',
    field: 'auditStatus',
  },

  {
    title: '使用的模型名称',
    field: 'model',
  },
  {
    title: '是否回复',
    field: 'isReplied',
    slots: { default: 'reply-status' },
  },
  {
    title: '最终回复内容',
    field: 'finalReply',
  },
  {
    title: '文章内容',
    field: 'content',
  },
  {
    title: '发布日期',
    field: 'publishDate',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];

export const modalSchema: FormSchemaGetter = () => [
  {
    label: '主键ID',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '文章链接',
    fieldName: 'articleLink',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '封面链接',
    fieldName: 'coverImageUrl',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '文章标题',
    fieldName: 'title',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '作者链接',
    fieldName: 'authorLink',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: 'CSS选择器',
    fieldName: 'selector',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '原始文章ID',
    fieldName: 'originId',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '审核状态',
    fieldName: 'auditStatus',
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      optionType: 'button',
    },
    rules: 'selectRequired',
  },
  {
    label: '回复内容',
    fieldName: 'replyContent',
    component: 'RichTextarea',
    componentProps: {
      // options: {
      //  readyonly: false, // 是否只读
      // }
      // width: '100%', // 宽度
      // showImageUpload: true, // 是否显示图片上传
      // height: 400 // 高度 默认400
    },
    rules: 'required',
  },
  {
    label: '推理过程说明',
    fieldName: 'reasoning',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '使用的模型名称',
    fieldName: 'model',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '模型标题',
    fieldName: 'modelTitle',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '用户名',
    fieldName: 'username',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '是否已回复 0-未回复 1-已回复',
    fieldName: 'isReplied',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '人工编辑的回复内容',
    fieldName: 'manualReply',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '最终回复内容',
    fieldName: 'finalReply',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '文章内容',
    fieldName: 'content',
    component: 'RichTextarea',
    componentProps: {
      // options: {
      //  readyonly: false, // 是否只读
      // }
      // width: '100%', // 宽度
      // showImageUpload: true, // 是否显示图片上传
      // height: 400 // 高度 默认400
    },
    rules: 'required',
  },
  {
    label: '发布日期',
    fieldName: 'publishDate',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '任务ID',
    fieldName: 'taskId',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'interactionId',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'commentStatus',
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      optionType: 'button',
    },
    rules: 'selectRequired',
  },
  {
    label: '',
    fieldName: 'commentReason',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'screenUrl',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'accountId',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'publishTime',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'publishLocation',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'employeeId',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'employeeName',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '',
    fieldName: 'actualPublishDate',
    component: 'Input',
    rules: 'required',
  },
];
